home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Lowpass.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  2.7 KB  |  107 lines

  1. /*
  2. ** $VER: Lowpass.ieb 1.12, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 2/2 1996 Stockholm/Sweden
  6. **
  7. ** Apply lowpass to image.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.  
  41.   MaskWidth=5 ; MaskHeight=5
  42.  
  43.   if command ~= '' then parse var command MaskWidth MaskHeight
  44.  
  45.   'IE_TO_FRONT'
  46.  
  47.   'FORM "Lowpass" " OK | Cancel "',
  48.   ' INTEGER,"Mask Width",1,25,'MaskWidth',SLIDER',
  49.   ' INTEGER,"Mask Height",1,25,'MaskHeight',SLIDER'
  50.  
  51.   parse var result ok MaskWidth MaskHeight .
  52.   if ok = 0 then return '<ERROR>'
  53.  
  54.   back = MaskWidth MaskHeight
  55. return back
  56.  
  57. /* Required "Process_image" procedure  ------------------------------- */
  58.  
  59. process_image:
  60.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  61.   parse var options MaskWidth MaskHeight .
  62.  
  63.   'OPEN' '"'src_image'"' '24'
  64.   if (RC ~= 0) then do
  65.     'IE_TO_FRONT'
  66.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  67.     return '<ERROR>'
  68.   end
  69.   else LoadImage = result
  70.  
  71.   'LOWPASS' LoadImage MaskWidth MaskHeight
  72.   OutputImage = result
  73.   'CLOSE' LoadImage
  74.  
  75.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  76.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  77.   if (RC ~= 0) then do
  78.     'IE_TO_FRONT'
  79.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  80.     return '<ERROR>'
  81.   end
  82.   'CLOSE' OutputImage
  83.  
  84.   back = 'OK'
  85. return back
  86.  
  87. /* Internal procedures  ---------------------------------------------- */
  88.  
  89. /*******************************************************************/
  90. /* This is where control goes when an error code is returned by IE */
  91. /* It puts up a message saying what happened and on which line     */
  92. /*******************************************************************/
  93.  
  94. error:
  95. if RC=5 then do
  96.     IE_TO_FRONT
  97.     LAST_ERROR
  98.     'REQUEST "'||RESULT||'"'
  99. end
  100. else do
  101.     IE_TO_FRONT
  102.     LAST_ERROR
  103.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  104. end
  105.  
  106. return '<ERROR>'
  107.